package com.punai.dataclean.controller;

import com.punai.common.core.controller.BaseController;
import com.punai.common.core.domain.AjaxResult;
import com.punai.common.core.page.TableDataInfo;
import com.punai.dataclean.constants.CostDataConstanta;
import com.punai.dataclean.domain.vo.CostDataCleanVo;
import com.punai.dataclean.domain.vo.IncomeDataCleanVo;
import com.punai.dataclean.service.CostDataCleanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/dataclean/costdataclean")
public class CostDataCleanController extends BaseController {

    @Autowired
    private CostDataCleanService costDataCleanService;

    /**
     * 查询页签列表
     */
    @PreAuthorize("@ss.hasPermi('dataclean:costdataclean:getTabs')")
    @GetMapping("/getTabs")
    public AjaxResult getTabs() {
        return AjaxResult.success(CostDataConstanta.Tabs.getAllTab());
    }

    /**
     * 查询所有价格类型
     */
    @PreAuthorize("@ss.hasPermi('dataclean:costdataclean:getAllPriceType')")
    @GetMapping("/getAllPriceType")
    public AjaxResult getAllPriceType() {
        return AjaxResult.success(CostDataCleanService.CostProjectTypeKV);
    }


    @PreAuthorize("@ss.hasPermi('dataclean:costdataclean:getGroupTableData')")
    @GetMapping("/getGroupTableData")
    public TableDataInfo getGroupTableData(CostDataCleanVo vo) {
        return costDataCleanService.getGroupTableData(vo);
    }

    @PreAuthorize("@ss.hasPermi('dataclean:costdataclean:getDetailTableData')")
    @GetMapping("/getDetailTableData")
    public AjaxResult getDetailTableData(CostDataCleanVo vo) {
        return AjaxResult.success(costDataCleanService.getDetailTableData(vo));
    }

    @PreAuthorize("@ss.hasPermi('dataclean:costdataclean:claen')")
    @PostMapping("/enterClean")
    public AjaxResult enterClean(@RequestBody CostDataCleanVo vo) {
        return AjaxResult.success(costDataCleanService.enterClean(vo));
    }

    @PreAuthorize("@ss.hasPermi('dataclean:costdataclean:claen')")
    @GetMapping("/allEnterClean")
    public AjaxResult allEnterClean(CostDataCleanVo vo) {
        return AjaxResult.success(costDataCleanService.allEnterClean(vo));
    }

    @PreAuthorize("@ss.hasPermi('dataclean:incomedataclean:claen')")
    @GetMapping("/getFeeData")
    public TableDataInfo getFeeData(CostDataCleanVo vo) {
        return costDataCleanService.getFeeData(vo);
    }
}
